from flask import Blueprint
from flask import request
from json import dumps

from comm.tdb import tdb


def _list() -> str:
    tb = tdb.table('javbus')
    data = tb.all()
    for i in data:
        if i['local_img']:
            i['img'] = i['local_img']
    return dumps(data)


bus = Blueprint('bus', __name__)
bus.add_url_rule('/bus/list', view_func=_list, methods=['GET', 'POST'])
